package com.example.springworkfront.Dao;

import com.example.springworkfront.Entity.Household;
import org.apache.ibatis.annotations.*;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

import java.util.HashMap;

@Repository

public interface HouseholdRepository {

    @Select("select * from household where openid=#{openid}")
    Household findHouseholdByOpenid(@Param("openid") String openid);
    @Insert("insert into household(account,password,name,phone,id_card,room_number,img,access_times,openid,status) values(#{o.account},#{o.password},#{o.name},#{o.phone},#{o.idCard},#{o.roomNumber},#{o.img},#{o.accessTimes},#{o.openid},#{o.status})")
    void save(@Param(value = "o") Household household);
    @Select("select * from household where account=#{account}")
    Household findById(@Param("account") String account);
    @Update("update household set access_times=#{times},status=#{status} where account=#{account}")
    void update(@Param("account") String account,@Param("times") int times,String status);
}


